<!-- 
@name: 首页
-->
<template>
	<div id="evaluation" class="page">
		<div class="whiteWrap">
			<div class="flex-row">
				<div class="title" style="margin-right:0.2rem">问题描述</div>
			</div>
			<van-field style="background:#FAFAFA" v-model="content" rows="10" autosize label="" type="textarea" maxlength="200" placeholder="请填写问题描述以便我们提供更好的帮助。" show-word-limit />
		</div>
		<!-- 底部操作栏 -->
		<div class="bottomButton flex-center">
			<div>
				<van-button class="button3" @click="submit">提交</van-button>
			</div>

		</div>
		<!-- 底部操作栏 end -->
	</div>
</template>
<script>
export default {
	name: 'app',
	components: {},
	data() {
		return {
			score: 0,
			content: '',
			photo: [
				// {
				// 	url: 'https://img01.yzcdn.cn/vant/leaf.jpg',
				// 	status: 'uploading',
				// 	message: '上传中...',
				// },
				// {
				// 	url: 'https://img01.yzcdn.cn/vant/tree.jpg',
				// 	status: 'failed',
				// 	message: '上传失败',
				// },
			],
		};
	},
	created() {},
	methods: {
		submit() {
			if (!this.content) {
				this.$notify({ type: 'warning', message: '请先填写意见' });
				return;
			}
			var params = {
				content: this.content,
			};
			this.$myApi.midea_centre(params).then((res) => {
				if (res.code == 0) {
					this.$notify({ type: 'success', message: '操作成功' });
					this.$router.back();
				} else {
				}
			});
		},
		afterRead(file) {
			// 此时可以自行将文件上传至服务器
			let params = new FormData();
			params.append('file', file.file);
			params.append('title', file.name);
			params.append('memo', file.name);
			this.$myApi.getToken().then((res) => {
				if (res.code == 0) {
					axios
						.post(this.$store.state.uploadUrl, params, {
							headers: {
								Authorization: 'Bearer ' + res.result,
							},
						})
						.then((res2) => {
							console.log('res2', res2);
							this.photo[this.photo.length - 1].url = res2.url;
						});
				} else {
				}
			});
		},
	},
};
</script>
<style lang="less">
#evaluation {
	padding-left: 0rem;
	padding-right: 0rem;
	min-height: 100vh;
	background-color: #fafafa;
	padding-bottom: 2rem;
	.bottomButton {
		position: fixed;
		bottom: 0;
		width: 100%;
		padding: 0.16rem 0.24rem;
		background: #fff;
	}
	.button3 {
		background: #ffce17;
		width: 6.5rem;
		border-radius: 50px;
		font-size: 0.32rem;
		font-family: PingFang SC;
		font-weight: bold;
		color: #333;
		padding: 0.3rem 0.57rem;
		height: auto;
	}
	.whiteWrap {
		width: 7rem;
		padding: 0.24rem 0.16rem;
		margin-left: 0.25rem;
		background: #fff;
		position: relative;
		box-sizing: border-box;
		margin-top: 0.2rem;
		.title {
			font-size: 0.32rem;
			color: #333333;
			font-weight: 800;
			margin-bottom: 0.24rem;
		}
	}
}
</style>
<style lang="less" scoped>
/deep/.van-tabs__nav--line.van-tabs__nav--complete {
	background: #f8f8f8;
}
/deep/.van-search .van-cell {
	padding-top: 0.2rem;
	padding-bottom: 0.2rem;
	font-size: 0.28rem;
}
/deep/.van-tab {
	// flex: 0 1 auto;
	// width: 1rem;
	font-size: 0.3rem;
}
/deep/.van-tab--active {
	font-weight: bold;
	font-size: 0.32rem;
}
</style>